home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 021a / hpgl2scr.zip / HPGL2SCR.DOC < prev    next >
Text File  |  1991-09-19  |  5KB  |  121 lines

  1.  
  2.  
  3.         HPGL TO AUTOCAD SCRIPT FILE CONVERSION PROGRAM
  4.  
  5. Recently, my lab at work switched from LogiCadd to AutoCAD.  What a 
  6. difference!  The only problem was that we needed to redo some old drawings 
  7. for a new paper.  We couldn't find a program that would convert the files 
  8. directly, so we were left with the choice of either re-entering the 
  9. drawings by hand or writing our own conversion program.
  10.   
  11. LogiCadd drawing files have some proprietary format, as do AutoCAD, and I 
  12. could find virtually no documentation on either.  LogiCadd will, however, 
  13. produce files of HPGL plotter commands which are (almost) pure ASCII text.  
  14. AutoCAD cannot read HPGL, but it does have a script language which can 
  15. contain drawing commands, again in an ASCII file. 
  16.  
  17. This program, HPGL2SCR, converts some common HPGL commands into AutoCAD 
  18. script language commands.  The conversions are as follows: 
  19.  
  20. HPGL Command            Function                AutoCAD Script Command
  21.  
  22. IP (P1X,P1Y(,P2X,P2Y)); Set locations for the   *
  23.                         scaling points P1 and
  24.                         P2.
  25. LB (YOUR TEXT HERE)^C   Plot labels, titles,    TEXT LASTX,LASTY 
  26.                         or other text.            [YOUR TEXT HERE] \n
  27. PA X,Y(,...);           Move the pen to one     LINE LASTX,LASTY X,Y (...)
  28.                         or more sets of
  29.                         points (X,Y).
  30. PD (X,Y,...);           Put the pen to the      none
  31.                         paper.  Optionally 
  32.                         move to (X,Y);
  33. PU (X,Y,...);           Lift the pen from the   none
  34.                         paper.  Optionally 
  35.                         move to (X,Y);
  36. SC (U1X,U2X,U1Y,U2Y);   Establish user-unit     *
  37.                         coordinate system 
  38.                         between P1 and P2.
  39. SR (width,height);      Change size of chars    STYLE TXT [HEIGHT] [ASPECT]
  40.                         plotted with LB as a
  41.                         percentage of distance
  42.                         between P1 and P2.
  43.  
  44. 1. Optional parameters are shown in parentheses.  If no parameters are 
  45.    included, default values are used.
  46.  
  47. 2. IP and SC combine to determine the relationship between user units and 
  48.    AutoCAD units.  Default values for the IP instruction are P1X = 250, 
  49.    P1Y = 279, P2X = 10250, and P2Y = 7479. For SC, it's U1X = P1X, 
  50.    U2X = P2X, U1Y = P1Y, and U2Y = P2Y.  If the user coordinates are AX 
  51.    and AY, the AutoCAD coordinates are determined by the equations 
  52.  
  53.         X = ((AX - U1X) * (P2X - P1X) / (U2X - U1X) + P1X) / 1000 
  54.         Y = ((AY - U1Y) * (P2Y - P1Y) / (U2Y - U1Y) + P1Y) / 1000 
  55.  
  56.    Trust me.
  57.  
  58.  
  59.                                    Page 1
  60.  
  61.  
  62.  
  63. 3. The SR instruction calculates HEIGHT and ASPECT as
  64.  
  65.         HEIGHT = height * (P2Y - P1Y) / 100000
  66.         ASPECT = width / height * (P2X - P1X) / (P2Y - P1Y)
  67.  
  68.    Default values are height = 0.75 and width = 1.5, this time I really 
  69.    mean it.
  70.  
  71. 4. Since the argument for the LB command may inadvertently contain other 
  72.    valid HPGL commands, it is detected and processed first.
  73.  
  74. The input file must have the extension ".PLT", although you must leave the 
  75. extension off when prompted for the input file name.  The input file name 
  76. may also be entered on the command line.  The output file will have the 
  77. same name, with the extension ".SCR".  To use this file, run AutoCAD and 
  78. choose to work on a new drawing.  When the drawing screen appears, type 
  79. "SCRIPT ", followed by the name of the script file.  Then just sit back and 
  80. watch!  The screen will automatically redraw when the input is complete.  
  81. You can then save the file just as with any other AutoCAD drawing.
  82.  
  83. Any HPGL command file produced by any program can be used as input.  Some 
  84. Hewlett-Packard instruments will produce screen dumps in HPGL format.  If 
  85. you can capture this into a file, you can use it.  While this program 
  86. clearly will not handle all possible HPGL commands, it is sufficient for 
  87. most purposes.  If it does not recognize a command, it ignores it.  Even if 
  88. you have to clean up the AutoCAD drawing a bit, this method is faster than 
  89. redoing the drawing from the start. 
  90.  
  91. With documentation on other drawing command languages, it seems like it 
  92. would be easy to modify this program to say, convert HPGL to GERBER or vice 
  93. versa.  There was a thread concerning GERBER photoplotter file format 
  94. recently in sci.electronics, for example.
  95.  
  96. A sample file called PROHOOPS.PLT is included.  Have Fun!
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114. William D. "Dev" Palmer, Ph.D.
  115. Dev Palmer Electronics Consulting
  116. 1313 Vickers Avenue
  117. Durham, NC  27707
  118. wdp@ee.egr.duke.edu
  119.  
  120.                                    Page 2
  121.